package sj2.ink;

import sj2.printer.Ink;

import java.awt.*;

public class GreyInk implements Ink {
    //打印灰色文字
    @Override
    public String getColor(int red, int green, int blue) {
        //先把传入的颜色值进行计算，转换成灰度
        int c=(red+green+blue)/3;
        //在进行格式转换并返回
        Color color=new Color(c,c,c);
        return "#"+Integer.toHexString(color.getRGB()).substring(2);
    }
}
